package com.xin.springcloudconsumer.utils;

import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
@Component
public class SessionUtils {

    public void saveToken(HttpServletRequest request,String token,String headImage){
          request.getSession().setAttribute("token",token);
          request.getSession().setAttribute("headImage",headImage);
    }

    public String getToken(HttpServletRequest request){
        String token = (String) request.getSession().getAttribute("token");
        return token;
    }

    public String getHeadImage(HttpServletRequest request){
        String headImage = (String) request.getSession().getAttribute("headImage");
        return headImage;
    }
}
